#!/bin/bash
set -e

function info() {
echo Usage: `basename $0` annovar.multianno.txt
exit 65
}

while getopts  ":b:p:" opts
do
        case  $opts  in
		b) build=$OPTARG;;
		p) out_prefix=$OPTARG;;
		*) info;;
        esac
done
shift $(($OPTIND - 1))


if [ $# -lt 1 ]; then info; fi


. /mnt/ilustre/app/medical/tools/.var

# export PATH=$PATH:/mnt/ilustre/app/medical/tools/impact

# collect_dinuc.pl $1 $data_path/impact/genetic_code.txt | single_remove_synon.pl -| remove_over.01.one.pl -| remove_over.01.two.pl -| get_deleterious.pl - > $out_prefix.deleterious.txt

impact_anno.py $1 $data_path/impact

cut -f1-7,9,10 *.deleterious.txt > $out_prefix.deleterious.sub.txt

# if test ! -d impact; then mkdir impact; fi;
# cd impact
# drug_prediction.pl ../$out_prefix.deleterious.txt && mv drug_prediction.txt ../$out_prefix.drug_prediction.txt && mv drug_prediction.html ..

# drugs.py ../$out_prefix.deleterious.txt $data_path/impact && 

# cd ..

mv drugs-prediction.txt $out_prefix.drug_prediction.txt

# cat drug_prediction.html |grep -n "LEVEL 1" ~ 7
cat drugs_prediction.html |sed -n '4,$p'|cat /mnt/ilustre/app/medical/tools/html/header.html - /mnt/ilustre/app/medical/tools/html/footer.html > $out_prefix.drug_prediction.html

rm -f drugs_prediction.html